
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
  <meta charset="utf-8">
  <title>ksnowlv</title>
  <meta name="author" content="律威">

  
  <meta name="description" content="python内置类属性 __doc__:类的文档字符串. __name__:类名. __dict__:类的属性,包含一个字典，由类的数据属性组成 __module__: 类定义所在的模块 __base__:类的所有父类构成元素（包含了以个由所有父类组成的元组). 代码示例如下: 1
2
3
4
5 &hellip;">
  

  <!-- http://t.co/dKP3o1e -->
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  
  <link rel="canonical" href="http://ksnowlv.github.io/blog/page/12">
  <link href="/favicon.png" rel="icon">
  <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
  <link href="/atom.xml" rel="alternate" title="ksnowlv" type="application/atom+xml">
  <script src="/javascripts/modernizr-2.0.js"></script>
  <script src="//ajax.useso.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
  <script src="/javascripts/octopress.js" type="text/javascript"></script>
  <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.useso.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.useso.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">

  
  <script type="text/javascript">
    var _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'UA-39546615-2']);
    // _gaq.push(['_trackPageview']);

    // (function() {
    //   var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    //   ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    //   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    // })();

    _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src='http://droidyue-tools.qiniudn.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
  </script>


</head>

<body   >
  <header role="banner"><hgroup>
  <h1><a href="/">ksnowlv</a></h1>
  
    <h2>回顾过去,总结以往;立足现在,铭记当下;技术为主,笔记而已.</h2>
  
</hgroup>

</header>
  <nav role="navigation"><ul class="subscription" data-subscription="rss">
  <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
  
</ul>
  
<form action="http://google.com/search" method="get">
  <fieldset role="search">
    <input type="hidden" name="q" value="site:ksnowlv.github.io" />
    <input class="search" type="text" name="q" results="0" placeholder="Search"/>
  </fieldset>
</form>
  
<ul class="main-navigation">
  <li><a href="/">博客首页</a></li>
  <li><a href="/blog/archives">文章列表</a></li>
  <!-- <li><a href="/about-me">关于我</a></li>
 -->
</ul>

</nav>
  <div id="main">
    <div id="content">
      <div class="blog-index">
  
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/06/python-mian-xiang-dui-xiang-nei-zhi-lei-shu-xing/">Python面向对象-内置类属性</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-06T20:20:00+08:00" pubdate data-updated="true">Aug 6<span>th</span>, 2014</time>
        
         | <a href="/blog/2014/08/06/python-mian-xiang-dui-xiang-nei-zhi-lei-shu-xing/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><p>python内置类属性</p>

<pre><code>__doc__:类的文档字符串.

__name__:类名.

__dict__:类的属性,包含一个字典，由类的数据属性组成

__module__: 类定义所在的模块

__base__:类的所有父类构成元素（包含了以个由所有父类组成的元组).
</code></pre>

<p>代码示例如下:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="c">#!/usr/bin/python</span>
</span><span class='line'>
</span><span class='line'><span class="k">class</span> <span class="nc">Teacher</span><span class="p">:</span>
</span><span class='line'>   <span class="s">&#39;Common base class for all teacher&#39;</span>
</span><span class='line'>   <span class="n">teacherCount</span> <span class="o">=</span> <span class="mi">0</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">age</span><span class="p">):</span>
</span><span class='line'>      <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
</span><span class='line'>      <span class="bp">self</span><span class="o">.</span><span class="n">age</span> <span class="o">=</span> <span class="n">age</span>
</span><span class='line'>      <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span> <span class="o">+=</span> <span class="mi">1</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">displayCount</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>     <span class="k">print</span> <span class="s">&quot;Total Teacher </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">displayTeacher</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>      <span class="k">print</span> <span class="s">&quot;Name : &quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>  <span class="s">&quot;, Age: &quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">age</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;This would create first object of Teacher class&quot;</span>
</span><span class='line'><span class="n">t1</span> <span class="o">=</span> <span class="n">Teacher</span><span class="p">(</span><span class="s">&quot;张明&quot;</span><span class="p">,</span> <span class="mi">24</span><span class="p">)</span>
</span><span class='line'><span class="s">&quot;This would create second object of Teacher class&quot;</span>
</span><span class='line'><span class="n">t2</span> <span class="o">=</span> <span class="n">Teacher</span><span class="p">(</span><span class="s">&quot;李海&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">)</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">displayTeacher</span><span class="p">()</span>
</span><span class='line'><span class="n">t2</span><span class="o">.</span><span class="n">displayTeacher</span><span class="p">()</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Total Teacher </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;添加一属性address&quot;</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="s">&quot;北京市朝阳区&quot;</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> 居住在</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">t1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span><span class="n">t1</span><span class="o">.</span><span class="n">address</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;修改一属性address&quot;</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="s">&quot;北京市海淀区&quot;</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> 搬家到</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">t1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span><span class="n">t1</span><span class="o">.</span><span class="n">address</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;删除属性address&quot;</span>
</span><span class='line'><span class="k">del</span> <span class="n">t1</span><span class="o">.</span><span class="n">address</span>
</span><span class='line'>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Teacher.__doc__&quot;</span><span class="p">,</span><span class="n">Teacher</span><span class="o">.</span><span class="n">__doc__</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Teacher.__name__&quot;</span><span class="p">,</span><span class="n">Teacher</span><span class="o">.</span><span class="n">__name__</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Teacher.__module__&quot;</span><span class="p">,</span><span class="n">Teacher</span><span class="o">.</span><span class="n">__module__</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Teacher.__bases__&quot;</span><span class="p">,</span><span class="n">Teacher</span><span class="o">.</span><span class="n">__bases__</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Teacher.__dict__&quot;</span><span class="p">,</span><span class="n">Teacher</span><span class="o">.</span><span class="n">__dict__</span>
</span></code></pre></td></tr></table></div></figure>


<p>运行结果如下：</p>

<pre><code>ksnowlv@ksnowlvdeMacBook-Pro~/Documents/lvwei projects/python$python teacher_inner_property.py 
Name :  张明 , Age:  24
Name :  李海 , Age:  30
Total Teacher 2
张明 居住在北京市朝阳区
张明 搬家到北京市海淀区
Teacher.__doc__ Common base class for all teacher
Teacher.__name__ Teacher
Teacher.__module__ __main__
Teacher.__bases__ ()
Teacher.__dict__ {'__module__': '__main__', 
'displayCount': &lt;function displayCount at 0x10572c410&gt;, 
'displayTeacher': &lt;function displayTeacher at 0x10572cb18&gt;, 
'teacherCount': 2, 
'__doc__': 'Common base class for all teacher', 
'__init__': &lt;function __init__ at 0x105725d70&gt;}    
</code></pre>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/05/python-mian-xiang-dui-xiang-lei-ding-yi/">Python面向对象-类定义</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-05T23:33:00+08:00" pubdate data-updated="true">Aug 5<span>th</span>, 2014</time>
        
         | <a href="/blog/2014/08/05/python-mian-xiang-dui-xiang-lei-ding-yi/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><h4>1.python类的定义</h4>

<p>使用class语句定义一个类，class之后为类的名称并以冒号结尾，如下实例:</p>

<pre><code>class ClassName:

   'Optional class documentation string'#类文档字符串

   class_body  #类体
</code></pre>

<p> <code>类的帮助信息</code>可以通过<code>ClassName.__doc__</code>查看。</p>

<p><code>class_body</code> 由<code>类成员</code>，<code>方法</code>，<code>数据属性</code>组成。</p>

<h4>2.创建老师类，类成员，方法，属性。</h4>

<h4>代码示例如下</h4>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="c">#!/usr/bin/python</span>
</span><span class='line'>
</span><span class='line'><span class="k">class</span> <span class="nc">Teacher</span><span class="p">:</span>
</span><span class='line'>   <span class="s">&#39;Common base class for all teacher&#39;</span>
</span><span class='line'>   <span class="n">teacherCount</span> <span class="o">=</span> <span class="mi">0</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">age</span><span class="p">):</span>
</span><span class='line'>      <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
</span><span class='line'>      <span class="bp">self</span><span class="o">.</span><span class="n">age</span> <span class="o">=</span> <span class="n">age</span>
</span><span class='line'>      <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span> <span class="o">+=</span> <span class="mi">1</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">displayCount</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>     <span class="k">print</span> <span class="s">&quot;Total Teacher </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span>
</span><span class='line'>
</span><span class='line'>   <span class="k">def</span> <span class="nf">displayTeacher</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span class='line'>      <span class="k">print</span> <span class="s">&quot;Name : &quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>  <span class="s">&quot;, Age: &quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">age</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;This would create first object of Teacher class&quot;</span>
</span><span class='line'><span class="n">t1</span> <span class="o">=</span> <span class="n">Teacher</span><span class="p">(</span><span class="s">&quot;张明&quot;</span><span class="p">,</span> <span class="mi">24</span><span class="p">)</span>
</span><span class='line'><span class="s">&quot;This would create second object of Teacher class&quot;</span>
</span><span class='line'><span class="n">t2</span> <span class="o">=</span> <span class="n">Teacher</span><span class="p">(</span><span class="s">&quot;李海&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">)</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">displayTeacher</span><span class="p">()</span>
</span><span class='line'><span class="n">t2</span><span class="o">.</span><span class="n">displayTeacher</span><span class="p">()</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;Total Teacher </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">Teacher</span><span class="o">.</span><span class="n">teacherCount</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;添加一属性address&quot;</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="s">&quot;北京市朝阳区&quot;</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> 居住在</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">t1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span><span class="n">t1</span><span class="o">.</span><span class="n">address</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;修改一属性address&quot;</span>
</span><span class='line'><span class="n">t1</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="s">&quot;北京市海淀区&quot;</span>
</span><span class='line'><span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> 搬家到</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">t1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span><span class="n">t1</span><span class="o">.</span><span class="n">address</span><span class="p">)</span>
</span><span class='line'>
</span><span class='line'><span class="s">&quot;删除属性address&quot;</span>
</span><span class='line'><span class="k">del</span> <span class="n">t1</span><span class="o">.</span><span class="n">address</span>
</span></code></pre></td></tr></table></div></figure>


<p>运行情况如下:</p>

<pre><code>Name :  张明 , Age:  24
Name :  李海 , Age:  30
Total Teacher 2
张明 居住在北京市朝阳区
张明 搬家到北京市海淀区
</code></pre>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/05/shi-yong-nsurlprotocol-lan-jie-ti-huan-httpqing-qiu/">使用NSURLProtocol拦截替换http请求</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-05T05:51:00+08:00" pubdate data-updated="true">Aug 5<span>th</span>, 2014</time>
        
         | <a href="/blog/2014/08/05/shi-yong-nsurlprotocol-lan-jie-ti-huan-httpqing-qiu/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><h4>使用背景:整个工程中中图片url需要添加额外的参数支持图片优化，包括webview部分。</h4>

<h4>所以使用NSURLProtocol拦截相关URL,替换http请求，实现图片优化参数的统一支持。</h4>

<h4>具体做法如下：</h4>

<h4>1.声明继承NSURLProtocol的子类QImageURLProtocol.</h4>

<p>头文件内容如下：</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='objective-c'><span class='line'><span class="cm">/**</span>
</span><span class='line'><span class="cm"> *  用于测试的url</span>
</span><span class='line'><span class="cm"> */</span>
</span><span class='line'><span class="k">static</span> <span class="n">NSString</span> <span class="o">*</span><span class="n">KPicBURL</span> <span class="o">=</span> <span class="s">@&quot;http://g.hiphotos.baidu.com/image/h%3D800%3Bcrop%3D0%2C0%2C1280%2C800/sign=ee4c561ac1fdfc03fa78eeb8e404e4e6/a686c9177f3e6709ef8de51b39c79f3df9dc5540.jpg&quot;</span><span class="p">;</span>
</span><span class='line'><span class="k">static</span> <span class="n">NSString</span> <span class="o">*</span><span class="n">KPicAURL</span> <span class="o">=</span> <span class="s">@&quot;http://d.hiphotos.baidu.com/image/h%3D800%3Bcrop%3D0%2C0%2C1280%2C800/sign=ee81c70e83cb39dbdec06a56e02d6a56/b812c8fcc3cec3fdcf460491d488d43f869427dd.jpg&quot;</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'><span class="k">@interface</span> <span class="nc">QImageURLProtocol</span> : <span class="nc">NSURLProtocol</span>
</span><span class='line'>
</span><span class='line'><span class="k">@end</span>
</span></code></pre></td></tr></table></div></figure>


<p></p>

<p>实现文件内容如下：</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
<span class='line-number'>56</span>
<span class='line-number'>57</span>
<span class='line-number'>58</span>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
<span class='line-number'>62</span>
<span class='line-number'>63</span>
<span class='line-number'>64</span>
<span class='line-number'>65</span>
<span class='line-number'>66</span>
<span class='line-number'>67</span>
<span class='line-number'>68</span>
<span class='line-number'>69</span>
<span class='line-number'>70</span>
<span class='line-number'>71</span>
<span class='line-number'>72</span>
<span class='line-number'>73</span>
<span class='line-number'>74</span>
<span class='line-number'>75</span>
<span class='line-number'>76</span>
<span class='line-number'>77</span>
</pre></td><td class='code'><pre><code class='objective-c'><span class='line'><span class="k">@interface</span> <span class="nc">QImageURLProtocol</span> <span class="p">()</span>
</span><span class='line'>
</span><span class='line'><span class="k">@property</span> <span class="p">(</span><span class="n">nonatomic</span><span class="p">,</span> <span class="n">strong</span><span class="p">)</span> <span class="n">NSURLConnection</span> <span class="o">*</span><span class="n">connection</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'><span class="k">@end</span>
</span><span class='line'>
</span><span class='line'><span class="k">@implementation</span> <span class="nc">QImageURLProtocol</span>
</span><span class='line'>
</span><span class='line'><span class="cp">#pragma mark -----------NSURLProtocol-------------</span>
</span><span class='line'>
</span><span class='line'><span class="k">+</span><span class="p">(</span><span class="kt">BOOL</span><span class="p">)</span><span class="nf">canInitWithRequest:</span><span class="p">(</span><span class="n">NSURLRequest</span> <span class="o">*</span><span class="p">)</span><span class="nv">request</span><span class="p">{</span>
</span><span class='line'>    <span class="n">NSLog</span><span class="p">(</span><span class="s">@&quot;----origin request url = %@&quot;</span><span class="p">,</span><span class="n">request</span><span class="p">.</span><span class="n">URL</span><span class="p">.</span><span class="n">absoluteString</span><span class="p">);</span>
</span><span class='line'>    <span class="k">if</span> <span class="p">([</span><span class="n">self</span> <span class="nl">isQImageURLRequest:</span><span class="n">request</span><span class="p">])</span> <span class="p">{</span>
</span><span class='line'>        <span class="k">return</span> <span class="n">YES</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'>    <span class="k">return</span> <span class="n">NO</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">+</span><span class="p">(</span><span class="n">NSURLRequest</span> <span class="o">*</span><span class="p">)</span><span class="nf">canonicalRequestForRequest:</span><span class="p">(</span><span class="n">NSURLRequest</span> <span class="o">*</span><span class="p">)</span><span class="nv">request</span><span class="p">{</span>
</span><span class='line'>    <span class="n">NSMutableURLRequest</span> <span class="o">*</span><span class="n">cdnRequest</span> <span class="o">=</span> <span class="p">[</span><span class="n">request</span> <span class="n">mutableCopy</span><span class="p">];</span>
</span><span class='line'>    <span class="n">cdnRequest</span><span class="p">.</span><span class="n">URL</span> <span class="o">=</span> <span class="p">[</span><span class="n">self</span> <span class="nl">imagesForQImageURL:</span><span class="n">request</span><span class="p">.</span><span class="n">URL</span><span class="p">];</span>
</span><span class='line'>    <span class="c1">//[NSURLProtocol setProperty:@&quot;YES&quot; forKey:@&quot;QImageURL&quot; inRequest:cdnRequest];</span>
</span><span class='line'>    <span class="k">return</span> <span class="n">cdnRequest</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">startLoading</span> <span class="p">{</span>
</span><span class='line'>    <span class="n">self</span><span class="p">.</span><span class="n">connection</span> <span class="o">=</span> <span class="p">[</span><span class="n">NSURLConnection</span> <span class="nl">connectionWithRequest:</span><span class="p">[</span><span class="n">QImageURLProtocol</span> <span class="nl">canonicalRequestForRequest:</span><span class="n">self</span><span class="p">.</span><span class="n">request</span> <span class="p">]</span> <span class="nl">delegate:</span><span class="n">self</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">stopLoading</span> <span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">self</span><span class="p">.</span><span class="n">connection</span> <span class="n">cancel</span><span class="p">];</span>
</span><span class='line'>    <span class="n">self</span><span class="p">.</span><span class="n">connection</span> <span class="o">=</span> <span class="nb">nil</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">connection:</span><span class="p">(</span><span class="n">NSURLConnection</span> <span class="o">*</span><span class="p">)</span><span class="nv">connection</span> <span class="nf">didReceiveResponse:</span><span class="p">(</span><span class="n">NSURLResponse</span> <span class="o">*</span><span class="p">)</span><span class="nv">response</span> <span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">self</span><span class="p">.</span><span class="n">client</span> <span class="nl">URLProtocol:</span><span class="n">self</span> <span class="nl">didReceiveResponse:</span><span class="n">response</span> <span class="nl">cacheStoragePolicy:</span><span class="n">NSURLCacheStorageNotAllowed</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">connection:</span><span class="p">(</span><span class="n">NSURLConnection</span> <span class="o">*</span><span class="p">)</span><span class="nv">connection</span> <span class="nf">didReceiveData:</span><span class="p">(</span><span class="n">NSData</span> <span class="o">*</span><span class="p">)</span><span class="nv">data</span> <span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">self</span><span class="p">.</span><span class="n">client</span> <span class="nl">URLProtocol:</span><span class="n">self</span> <span class="nl">didLoadData:</span><span class="n">data</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">connectionDidFinishLoading:</span><span class="p">(</span><span class="n">NSURLConnection</span> <span class="o">*</span><span class="p">)</span><span class="nv">connection</span> <span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">self</span><span class="p">.</span><span class="n">client</span> <span class="nl">URLProtocolDidFinishLoading:</span><span class="n">self</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">connection:</span><span class="p">(</span><span class="n">NSURLConnection</span> <span class="o">*</span><span class="p">)</span><span class="nv">connection</span> <span class="nf">didFailWithError:</span><span class="p">(</span><span class="n">NSError</span> <span class="o">*</span><span class="p">)</span><span class="nv">error</span> <span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">self</span><span class="p">.</span><span class="n">client</span> <span class="nl">URLProtocol:</span><span class="n">self</span> <span class="nl">didFailWithError:</span><span class="n">error</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="cp">#pragma mark -----------------private method---------</span>
</span><span class='line'>
</span><span class='line'><span class="k">+</span><span class="p">(</span><span class="kt">BOOL</span><span class="p">)</span><span class="nf">isQImageURLRequest:</span><span class="p">(</span><span class="n">NSURLRequest</span><span class="o">*</span><span class="p">)</span><span class="nv">request</span><span class="p">{</span>
</span><span class='line'>    <span class="k">if</span> <span class="p">(</span> <span class="p">[</span><span class="n">request</span><span class="p">.</span><span class="n">URL</span><span class="p">.</span><span class="n">host</span> <span class="nl">isEqualToString:</span><span class="s">@&quot;d.hiphotos.baidu.com&quot;</span><span class="p">]</span>
</span><span class='line'>        <span class="c1">//&amp;&amp;nil == [NSURLProtocol propertyForKey:@&quot;QImageURL&quot; inRequest:request]</span>
</span><span class='line'>        <span class="p">)</span>
</span><span class='line'>    <span class="p">{</span>
</span><span class='line'>        <span class="n">NSLog</span><span class="p">(</span><span class="s">@&quot;isQImageURLRequest&quot;</span><span class="p">);</span>
</span><span class='line'>        <span class="k">return</span> <span class="n">YES</span><span class="p">;</span>
</span><span class='line'>    <span class="p">}</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">return</span> <span class="n">NO</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'><span class="k">+</span><span class="p">(</span><span class="n">NSURL</span><span class="o">*</span><span class="p">)</span><span class="nf">imagesForQImageURL:</span><span class="p">(</span><span class="n">NSURL</span><span class="o">*</span><span class="p">)</span><span class="nv">url</span><span class="p">{</span>
</span><span class='line'>    <span class="c1">//只要是KPicAURL，会被直接替换为KPicBURL</span>
</span><span class='line'>    <span class="k">if</span> <span class="p">([</span><span class="n">url</span><span class="p">.</span><span class="n">host</span> <span class="nl">isEqualToString:</span><span class="s">@&quot;d.hiphotos.baidu.com&quot;</span> <span class="p">]</span>
</span><span class='line'>        <span class="o">&amp;&amp;</span> <span class="p">[</span><span class="n">url</span><span class="p">.</span><span class="n">absoluteString</span> <span class="nl">isEqualToString:</span><span class="n">KPicAURL</span> <span class="p">])</span> <span class="p">{</span>
</span><span class='line'>         <span class="n">NSLog</span><span class="p">(</span><span class="s">@&quot;----real request url = %@&quot;</span><span class="p">,</span><span class="n">KPicBURL</span><span class="p">);</span>
</span><span class='line'>        <span class="k">return</span> <span class="p">[</span><span class="n">NSURL</span> <span class="nl">URLWithString:</span><span class="n">KPicBURL</span><span class="p">];</span>
</span><span class='line'>    <span class="p">};</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">return</span> <span class="n">url</span><span class="p">;</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">@end</span>
</span></code></pre></td></tr></table></div></figure>


<p>调用如下：</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
</pre></td><td class='code'><pre><code class='objective-c'><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">dealloc</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">NSURLProtocol</span> <span class="nl">unregisterClass:</span><span class="p">[</span><span class="n">QImageURLProtocol</span> <span class="n">class</span><span class="p">]];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">viewDidLoad</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="p">[</span><span class="n">super</span> <span class="n">viewDidLoad</span><span class="p">];</span>
</span><span class='line'>  <span class="c1">//关键一步</span>
</span><span class='line'>    <span class="p">[</span><span class="n">NSURLProtocol</span> <span class="nl">registerClass:</span><span class="p">[</span><span class="n">QImageURLProtocol</span> <span class="n">class</span><span class="p">]];</span>
</span><span class='line'>    <span class="n">_imageDownloadQueue</span> <span class="o">=</span> <span class="p">[[</span><span class="n">NSOperationQueue</span> <span class="n">alloc</span><span class="p">]</span> <span class="n">init</span><span class="p">];</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">-</span><span class="p">(</span><span class="kt">IBAction</span><span class="p">)</span><span class="nf">requestImageEvent:</span><span class="p">(</span><span class="kt">id</span><span class="p">)</span><span class="nv">sender</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>    <span class="n">NSURLRequest</span> <span class="o">*</span><span class="n">request</span> <span class="o">=</span> <span class="p">[</span> <span class="n">NSURLRequest</span> <span class="nl">requestWithURL:</span><span class="p">[</span><span class="n">NSURL</span> <span class="nl">URLWithString:</span><span class="n">KPicAURL</span><span class="p">]];</span>
</span><span class='line'>    <span class="p">[</span><span class="n">NSURLConnection</span> <span class="nl">sendAsynchronousRequest:</span><span class="n">request</span> <span class="nl">queue:</span><span class="n">_imageDownloadQueue</span> <span class="nl">completionHandler:</span><span class="o">^</span><span class="p">(</span><span class="n">NSURLResponse</span> <span class="o">*</span><span class="n">response</span><span class="p">,</span> <span class="n">NSData</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="n">NSError</span> <span class="o">*</span><span class="n">connectionError</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'>
</span><span class='line'>        <span class="k">if</span> <span class="p">(</span><span class="nb">nil</span> <span class="o">==</span> <span class="n">connectionError</span><span class="p">)</span> <span class="p">{</span>
</span><span class='line'>
</span><span class='line'>            <span class="n">UIImage</span> <span class="o">*</span><span class="n">image</span> <span class="o">=</span> <span class="p">[</span><span class="n">UIImage</span> <span class="nl">imageWithData:</span><span class="n">data</span><span class="p">];</span>
</span><span class='line'>
</span><span class='line'>            <span class="n">dispatch_async</span><span class="p">(</span><span class="n">dispatch_get_main_queue</span><span class="p">(),</span> <span class="o">^</span><span class="p">{</span>
</span><span class='line'>                <span class="n">_imageView</span><span class="p">.</span><span class="n">image</span> <span class="o">=</span> <span class="n">image</span><span class="p">;</span>
</span><span class='line'>            <span class="p">});</span>
</span><span class='line'>        <span class="p">}</span>
</span><span class='line'>
</span><span class='line'>    <span class="p">}];</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<h4>注意事项:</h4>

<h4>1.这种方法对于基于NSURLConnection的http请求是有效的,例如AFNetworking，对于基于CFNetwork框架的是不支持的,例如：MKNetworkKit,ASIHttpRequest.</h4>

<h4>2.无论对webView还是native的,只要是基于NSURLConnection的网络请求的,可以根据相关特征进行URL拦截替换.</h4>

<h5>3.如何一个工程当中，注册了多个拦截基于NSURLConnection的网络请求的类的情况下，最终生效的是最后拦截者。</h5>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/04/ios-ipad-ce-shi-gong-ju-zong-lan/">iOS/iPad测试工具总览</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-04T23:18:00+08:00" pubdate data-updated="true">Aug 4<span>th</span>, 2014</time>
        
         | <a href="/blog/2014/08/04/ios-ipad-ce-shi-gong-ju-zong-lan/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><h3>iOS/iPad测试工具都有哪些呢？总结如下图：</h3>

<p><img src="/images/post/2014-08-04-ios-ipad-ce-shi-gong-ju-zong-lan/iOS-iPad-ce-shi-gong-ju-shi-yong.png" alt="image" /></p>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/03/du-luo-ji-si-wei-20140613-da-guo-bu-neng-bu-shi-shu/">读罗辑思维20140613-大国不能不识数</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-03T21:16:00+08:00" pubdate data-updated="true">Aug 3<span>rd</span>, 2014</time>
        
         | <a href="/blog/2014/08/03/du-luo-ji-si-wei-20140613-da-guo-bu-neng-bu-shi-shu/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><p>大数据有什么好处？</p>

<h4>现在文明是建立在数据文明基础之上的一种生活方式。数据文明三点好处</h4>

<h4>1.是让人与人之间可以对话，而且可以得出阶段性的结论。</h4>

<h4>2.数据文明可以让人和人，尤其是陌生人之间的远程，大规模协作变的可能。陌生人之间的分工和协作，是现代财富创生的根本基石。</h4>

<h4>3.第三条好处 就是数据是一种可以累进的文明。知识和知识可以产生累进的作用。</h4>

<pre><code>中医是一种不能进展的文明方式(注意此时的语境，事实上中医是有进展发展的)，可是现代医学，我们统称的西医，纵然有千般不好，它有一个好处。
就是后人的成就，一定是站在前人的基础之上的。后人的发现一定是站在前人的阶梯之上的。
它的数据的一点点的演进，让人类对自己身体的认知边界，是虽然艰难，但是毕竟是在推进的一个知识系统。
</code></pre>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/03/du-luo-ji-si-wei-20140718-tuo-ke-wei-er-jiang-shi-yao/">读逻辑思维-20140718-托克维尔讲什么</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-03T14:39:00+08:00" pubdate data-updated="true">Aug 3<span>rd</span>, 2014</time>
        
         | <a href="/blog/2014/08/03/du-luo-ji-si-wei-20140718-tuo-ke-wei-er-jiang-shi-yao/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><p>法国托克维尔</p>

<p>&lt;旧制度和大革命>，它面对的最大问题是什么呢？</p>

<h4>1.第一个问题，法国人怎么了？</h4>

<pre><code>大革命期间，恐怖统治，血流成河。
正式行刑的有40W人，而且是同一民族国家内部。
</code></pre>

<h4>2.第二个问题，法国国力在大革命后从此一蹶不一振。</h4>

<pre><code>法国在拿破仑时代，欧洲经济，军事，政治强国，大革命时期后，一蹶不振，甚至在越南边境中法战争都惨败。
大革命后，国家满目疮痍，急需重建。
大革命，再不好，为整个法国争得了自由，复辟本身在道德上站不住脚。

##法国为啥爆发这么血腥的革命，封建领主制崩溃的结果，

##贵州成为遭人痛恨的阶层？因为只享受吃喝玩乐的权利，不去尽所谓地方公共事务的义务了。
那出来做恶并且吃喝玩乐的二代遭人恨也就很正常了

##为什么秦始皇修长城就搞出个哭倒长城的孟姜女，原来燕长城，赵长城就没有发生这样的惨剧呢？
因为那个是小地方共同主义，他们解决的是自己的问题，也就没有那么多的怨言了。
</code></pre>

<h4>3.第三个问题，大革命后，法国没有贵州这个中间阶层，普通民众这种原子社会结构的人直接面对中央政府？法国该如何走呢？是所有高度发展的文明都需要面对的一个问题。</h4>

<pre><code>##中国的处理方案是：
第一种方案:是皇权不下县，地方自治。
地方上有一些自治传统，一些士绅来处理地方上的事务。例如，修桥修路，慈善，地方纠纷等。
第二种方案:儒家的意识形态。
</code></pre>

<h4>&lt;论美国的民主>上卷:1835年 美国人突然提供了一个没有贵族社会，但是同时建成一个良好社会结构的全新的解决方案。</h4>

<pre><code>无论在美国的乡村，还是城市，公民自治传统是非常发达的。无论一个镇子，还是一个城市，很多问题就是从下到上逐层去解决。大大小小，林林总总，奇形怪状的各种各样的发达公民自治组织。
</code></pre>

<h4>4总结：自下而上，公民自治。</h4>

<pre><code>中国，企业，团体，个人如何走呢？
</code></pre>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/02/ru-he-kan-dai-tuan-dui-he-chan-pin/">如何看待团队和产品</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-02T07:31:00+08:00" pubdate data-updated="true">Aug 2<span>nd</span>, 2014</time>
        
         | <a href="/blog/2014/08/02/ru-he-kan-dai-tuan-dui-he-chan-pin/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><h4>如何看一个团队呢？</h4>

<pre><code>部门GM
整体精神，气质
梯队人才配置状况
制度流程运转执行情况
团队协作的顺畅性
口头约定执行力
会议是否高效，敏捷，决议的主动执行情况
资深老员工
有无架构师
团队变动：架构调整/离职/转岗/内乱
</code></pre>

<h4>如何看一个产品？</h4>

<pre><code>行业前景，市场格局，公司前景
产品价值：产品用户群，核心用户群
产品定位:核心/战略/靠谱创新性产品
产品团队:PM/PD，         战略/规划/
技术团队:技术力/产品力     执行/创新/   
团队变动：架构调整/离职/转岗/内乱
有无架构师        
</code></pre>

<h4>那如何看待团队和产品呢？</h4>

<pre><code>有无前景，有无格局，有无价值，
有无定位，有无战略，有无规划，有无执行，
有无创新，有无激情，有无频繁变动...
有无架构师
</code></pre>

<h4>无前景，无格局，无定位，无战略，无执行的产品，再强悍的团队，注定的苦逼!</h4>

<pre><code>技术流們，完全沉迷于技术的，要警醒! 
</code></pre>

<h4>有无架构师</h4>

<pre><code>移动互联网的世界里，务实？务虚？   
有架构师能力，可能并无架构师头衔的，技术架构往往是比较靠谱点的。
顶着架构师笔头衔，技术架构搞的跟地震/海啸的现场，对团队/个人都是灾难性的.
</code></pre>

<h4>人心散了，士气低落，墨守成规的团队，注定的悲剧!而所有的这一切根源于GM，boss，乱作为或不作为。</h4>

<h4>你看重什么，决定你的选择。个人只能尽力而为，做自己能做的。</h4>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/08/01/wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/">为Xcode添加快捷代码模板</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-08-01T11:43:00+08:00" pubdate data-updated="true">Aug 1<span>st</span>, 2014</time>
        
         | <a href="/blog/2014/08/01/wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><p>为了更快捷的写代码，可以添加代码模板。</p>

<h4>1.使用快捷键Command Option Control 2来打开代码片段库</h4>

<h4>2.把你的代码片段向代码片段库中拖。</h4>

<p> <img src="/images/post/2014-08-01-wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/shortcodetemplate1.png" alt="image" /></p>

<h4>3.选择该片段，并查看</h4>

<p> <img src="/images/post/2014-08-01-wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/shortcodetemplate2.png" alt="image" /></p>

<h4>4.点击 edit进行相关属性和代码模板编辑</h4>

<p> <img src="/images/post/2014-08-01-wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/shortcodetemplate3.png" alt="image" /></p>

<p> 在Xcode代码区输入completion shortcut即可看到提示效果</p>

<p> 其它两个类似：</p>

<p> <img src="/images/post/2014-08-01-wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/shortcodetemplate3.png" alt="image" /></p>

<p> <img src="/images/post/2014-08-01-wei-xcodetian-jia-kuai-jie-dai-ma-mo-ban/shortcodetemplate3.png" alt="image" /></p>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/07/31/pad-xian-tiao-zheng/">淘宝平板线调整</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-07-31T20:55:00+08:00" pubdate data-updated="true">Jul 31<span>st</span>, 2014</time>
        
         | <a href="/blog/2014/07/31/pad-xian-tiao-zheng/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><p>在杭州这三个月的光景，历经两次调整。</p>

<pre><code>第一次，计划调整我到o2o团队；
第二次，2017年7月31日下午，宣布pad线和手机线融合。
也是第二次见到HRG，第一次是在搬工位，如果视频面试不算的话。
</code></pre>

<p>在互联网行业这种组织架构调整，司空见惯。
一般是产品线不那么给力，至少在老大心中不那么给力;
接下来的,俗套的开始,&hellip;,也将有一个俗套的收尾。</p>

<p>也许,会是动荡的开始;
也许,是发展的契机
&hellip;</p>

<pre><code>   做自己能做的，做自己想做的，做一点，是一点。
</code></pre>
</div>
  
  


    </article>
  
  
    <article>
      
  <header>
    
      <h1 class="entry-title"><a href="/blog/2014/07/30/ru-zhi-a-li/">入职阿里</a></h1>
    
    
      <p class="meta">
        








  


<time datetime="2014-07-30T23:34:00+08:00" pubdate data-updated="true">Jul 30<span>th</span>, 2014</time>
        
         | <a href="/blog/2014/07/30/ru-zhi-a-li/#disqus_thread">Comments</a>
        
      </p>
    
  </header>


  <div class="entry-content"><h4>高铁6小时，从北京到了杭州，抵达百悦，就在杭州小驻一段。</h4>

<p>入职那天，入职引导，材料填写，工卡，入职培训&hellip;，于是乎搞了一天!</p>

<p>晚上给老大打电话，木有打通。还好，和<code>琪灵</code>聊过，知道我们的根据地在哪，东找西奔，找到组织了&hellip;</p>

<p>本以为，一起来的小伙伴，会一直坚持到回北京的时候。不曾想，却是因为<code>创业的原因</code>，很快回到了我也很渴望回去的北京！</p>

<h4>有两点我是一定要做的：</h4>

<pre><code>1.休养身体，准备要娃。
2.反思过去，总结现在。做自己能做的，做自己想做的。
</code></pre>

<h4>现在回过头来看，</h4>

<pre><code>1.这两点，我自己很满意，突破了自我。
2.环境不同，规则不同，需要适应。
3.都知道问题所在，都明白解决的方法，整体却执行缓慢。
只能尽力而为，做好自己能做的，做好自己可以做的。
萤火虫能发一点光，就是一线光明。
</code></pre>

<h4>腾讯和阿里的有哪些差异呢？根源在企业文化的差异！</h4>

<pre><code>腾讯是产品驱动型公司，务实，低调，实用，技术方面细腻，交互设计整体规划统一，细节也到位，产品体验较好。

阿里是业务驱动型公司，务虚，高调，big高，技术方向粗糙，交互设计整体规划不一致，不用提细节，不用提产品体验。

据说阿里，牛在战略。原来的淘宝，天猫，支付宝，这些是过去的战略牛。现在呢？将来呢？有下一个“淘宝“，“天猫”，“支付宝”么？

业务驱动型和产品驱动型模式，可能现在没有高低之分，谁会笑的更久，笑到最后呢？

在目前的移动互联网时代，看起来，腾讯略占上风，这个时代pk的是`产品经济`，`体验经济`！
</code></pre>
</div>
  
  


    </article>
  
  <div class="pagination">
    
      <a class="prev" href="/blog/page/13/">&larr; Older</a>
    
    <a href="/blog/archives">Blog Archives</a>
    
    <a class="next" href="/blog/page/11/">Newer &rarr;</a>
    
  </div>
</div>
<aside class="sidebar">
  
    <section>
  <h1>关于我</h1>
  <p>律威,QQ:309235009 微信:ksnowlv</p>
  <p>手机单机游戏/手机网游封神online/手机阅读/腾讯iOS地图客户端&实时公交&开放API(地图&街景)/iPad/iPhone淘宝客户端及性能优化</p>
  <p>目前在银客做银客/简理财/&#8230;</p>
  <p>能做一点,是一点;不求大成,不求一万年;积少成多,水到渠成!</p>
</section>
<section>
  <h1>最近发布</h1>
  <ul id="recent_posts">
    
      <li class="post">
        <a href="/blog/2017/04/26/android-drawable/">Android drawable</a>
      </li>
    
      <li class="post">
        <a href="/blog/2017/04/22/iOS-xia-shi-yong-ffmpeg/">iOS下使用ffmpeg</a>
      </li>
    
      <li class="post">
        <a href="/blog/2015/08/19/ios-you-xian-hou-tai-ren-wu/">iOS有限后台任务</a>
      </li>
    
      <li class="post">
        <a href="/blog/2015/08/19/android-xia-jie-ya-suo/">Android下gzip数据流解压缩</a>
      </li>
    
      <li class="post">
        <a href="/blog/2015/08/19/facebook-infer-de-shi-yong/">FaceBook-infer的使用</a>
      </li>
    
  </ul>
</section>
<section>
  <h1>分类</h1>
    <ul id="category-list"><li><a href='/blog/categories/android-jie-ya-suo/'>Android-解压缩 (1)</a></li><li><a href='/blog/categories/androidduo-xian-cheng/'>Android多线程 (3)</a></li><li><a href='/blog/categories/androidcha-jian/'>Android插件 (1)</a></li><li><a href='/blog/categories/androidhui-tu-./'>Android绘图。 (1)</a></li><li><a href='/blog/categories/androidwang-luo/'>Android网络 (1)</a></li><li><a href='/blog/categories/git/'>git (6)</a></li><li><a href='/blog/categories/githubbo-ke/'>github博客 (8)</a></li><li><a href='/blog/categories/ios/'>iOS (6)</a></li><li><a href='/blog/categories/ios-block/'>iOS-block (1)</a></li><li><a href='/blog/categories/ios-bug/'>iOS-Bug (2)</a></li><li><a href='/blog/categories/ios-memory/'>iOS-Memory (4)</a></li><li><a href='/blog/categories/ios-push/'>iOS-push (1)</a></li><li><a href='/blog/categories/ios-ui/'>iOS-UI (2)</a></li><li><a href='/blog/categories/ios-you-hua/'>iOS-优化 (1)</a></li><li><a href='/blog/categories/ios-nei-cun/'>iOS-内存 (1)</a></li><li><a href='/blog/categories/ios-ji-chu/'>iOS-基础 (3)</a></li><li><a href='/blog/categories/ios-duo-xian-cheng/'>iOS-多线程 (3)</a></li><li><a href='/blog/categories/ios-cun-chu/'>iOS-存储 (1)</a></li><li><a href='/blog/categories/ios-an-quan/'>iOS-安全 (1)</a></li><li><a href='/blog/categories/ios-wang-luo/'>iOS-网络 (13)</a></li><li><a href='/blog/categories/ios-jie-ya-suo/'>iOS-解压缩 (1)</a></li><li><a href='/blog/categories/ios-she-ji-mo-shi/'>iOS-设计模式 (1)</a></li><li><a href='/blog/categories/ios-diao-shi/'>iOS-调试 (1)</a></li><li><a href='/blog/categories/iosyou-hua/'>iOS优化 (1)</a></li><li><a href='/blog/categories/iosji-chu/'>iOS基础 (2)</a></li><li><a href='/blog/categories/iosyin-pin/'>iOS音频 (1)</a></li><li><a href='/blog/categories/mac/'>Mac (4)</a></li><li><a href='/blog/categories/mac-duo-xian-cheng/'>Mac-多线程 (1)</a></li><li><a href='/blog/categories/nginx/'>nginx (3)</a></li><li><a href='/blog/categories/php/'>php (3)</a></li><li><a href='/blog/categories/python/'>python (12)</a></li><li><a href='/blog/categories/swift/'>swift (11)</a></li><li><a href='/blog/categories/uml/'>UML (8)</a></li><li><a href='/blog/categories/xcode/'>Xcode (11)</a></li><li><a href='/blog/categories/chan-pin-she-ji/'>产品设计 (2)</a></li><li><a href='/blog/categories/gong-ju/'>工具 (2)</a></li><li><a href='/blog/categories/shu-ju-ku/'>数据库 (2)</a></li><li><a href='/blog/categories/sheng-huo-pian-duan/'>生活片段 (10)</a></li><li><a href='/blog/categories/zhi-ye-sheng-ya/'>职业生涯 (7)</a></li><li><a href='/blog/categories/du-shu/'>读书 (2)</a></li></ul>
</section>
<section>
  <h1>外部链接</h1>
    <ul id="外部链接">
    	<li><a href="https://developer.apple.com">苹果开发者中心</a> </li>
    	<li><a href="http://stackoverflow.com/questions/tagged/ios">stackoverflow</a></li>
    	<li><a href="http://ksnowlv.blog.163.com/blog/#m=0">ksnowlv网易博客</a></li>
	</ul>
</section>

  
</aside>

    </div>
  </div>
  <footer role="contentinfo"><p>
  Copyright &copy; 2017 - 律威 -
  <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>

  <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1253538110'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "v1.cnzz.com/z_stat.php%3Fid%3D1253538110%26online%3D1' type='text/javascript'%3E%3C/script%3E"));</script>

  <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F4c1727a94ea20751730e8a556dbdbf82' type='text/javascript'%3E%3C/script%3E"));
</script>

</p>



</footer>
  

<script type="text/javascript">
      var disqus_shortname = 'ksnowlv';
      
        
        var disqus_script = 'count.js';
      
    (function () {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    }());
</script>








</body>
</html>
